package cn.com.haopy.dataes.db.entity.main;

import cn.com.haopy.dataes.db.mybatis.JsonIntegerArrayTypeHandler;
import cn.com.haopy.dataes.db.entity.MainBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@TableName(value = "hd_admin", autoResultMap = true)
@ApiModel(value = "后台管理用户")
public class HDAdmin extends MainBaseEntity {
    @TableField(value = "username", jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "用户名")
    String username;

    @TableField(value = "password", jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "密码")
    String password;

    @TableField(value = "last_login_ip", jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "上次登录IP地址")
    String lastLoginIp;

    @TableField(value = "last_login_time", jdbcType = JdbcType.DATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "上次登录时间")
    LocalDateTime lastLoginTime;

    @TableField(value = "avatar", jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "头像")
    String avatar;

    @TableField(value = "role_ids", jdbcType = JdbcType.BLOB, typeHandler = JsonIntegerArrayTypeHandler.class)
    @ApiModelProperty(value = "权限列表")
    Integer[] roleIds;
}
